package social.hub.facebook;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import social.hub.facebook.FacebookClient;
import social.hub.facebook.FacebookClientImpl;
import social.hub.facebook.FacebookProfile;

public class ITFacebookClientImpl {

	private FacebookClient client;

	@Before
	public void setUp() throws Exception {
		final String accessToken = "129640830439428|2.AQARXFOIyI82_J-Q.3600.1308704400.1-100001507399106|wCNzaB6C9afYpNps1sW9vPnFIi0";
		client = new FacebookClientImpl(accessToken);
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetFriends() {

		int esperado = 59;

		final List<FacebookProfile> friends = client.getFriends();

		assertEquals(esperado, friends.size());

	}

	@Test
	public void testGetFriendsLong() {

		Long profileId = 100001507399106L;
		int esperado = 59;

		final List<FacebookProfile> friends = client.getFriends(profileId);

		assertEquals(esperado, friends.size());

	}

	@Test
	public void testGetUserProfile() {

		Long esperado = 100001507399106L;

		final FacebookProfile user = client.getUserProfile();

		assertEquals(esperado, user.getId());

	}

	@Test
	public void testGetUserProfileLong() {

		Long profileId = 100001507399106L;

		final FacebookProfile user = client.getUserProfile(profileId);

		assertEquals(profileId, user.getId());

	}

	@Test
	public void testUpdateStatus() {
		client.updateStatus("Teste Integração Facebook");
	}

	@Test
	public void testSendDirectMessage() {
		Long profileId = 100001007513893L;
		client.sendDirectMessage("Teste Integração Facebook", profileId);
	}

}
